package com.res.share.common.seo.translate;


import lombok.Data;

import java.io.Serializable;
import java.net.InetSocketAddress;
import java.net.Proxy;


@Data
public class Browser implements Serializable {

    public Proxy proxy;

    public String url;

    public void setProxy(String ip, Integer port) {
        this.proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(ip, port.intValue()));
    }

    public String executeGet()
            throws Exception {
        String result;
        if (this.proxy != null) {

            result = HttpClientUtil.doGetWithProxy(this.url, this.proxy);
        } else {
            result = HttpClientUtil.doGet(this.url);
        }
        return result;
    }
    public String executePost(String param){
        return HttpClientUtil.sendPost(this.url,param);
    }

}


